package sms

type SMSManager struct {
    driver SMS
}

type Option func(*SMSManager)

func WithDriver(driver SMS) Option {
    return func(s *SMSManager) {
        s.driver = driver
    }
}

func NewSmsManager(options ...Option) *SMSManager {
    manager:=&SMSManager{}
    for _,option:=range options{
        option(manager)
    }
    if manager.driver==nil{
        manager.driver=NewAliyunService()
    }
    return manager
}

func (s *SMSManager) SendLoginCode(phone,code string) (*SmsResp,error) {
    return s.driver.SendLoginCode(phone,code)
}